package cn.guet.eureka.client.boy.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import cn.guet.eureka.client.boy.client.IGirlClient;
import cn.guet.eureka.client.boy.service.IBoyService;

/**
 * Boy控制器
 *
 * @author SAGITTAR
 */
@RestController
public class BoyController {

    @Autowired
    @Qualifier(value = "boyService")
    private IBoyService boyService;

    @Autowired
    @Qualifier(value = "girlClient")
    private IGirlClient girlClient;

    /**
     * 请求本地输出
     *
     * @param name
     * @return
     */
    @GetMapping(value = "/hello/{name}")
    public String hello(@PathVariable String name) {
        return boyService.hello(name);
    }

    /**
     * 提供远程服务
     *
     * @param name
     * @return
     */
    @GetMapping(value = "/feign/{name}")
    public String feign(@PathVariable String name) {
        return boyService.feign(name);
    }

    /**
     * 调用远程服务
     *
     * @param name
     * @return
     */
    @GetMapping(value = "/feign-remote/{name}")
    public String feignRemote(@PathVariable String name) {
        return girlClient.feign(name);
    }
}
